package cn.sunlight.city.controller;

import cn.sunlight.city.pojo.Province;
import cn.sunlight.city.service.CityService;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: CityController
 * @Description: TODO
 * @Author: sunlight
 * @Date: 11:57 - 2022/2/10
 * @Version: 1.0
 **/
@RestController
@RequestMapping("/city")
public class CityController {

    @Autowired
    private CityService cityService;

    @GetMapping
    public String findAll(){
        List<Province> list = cityService.findProvince();

        String data = JSON.toJSONString(list);
        return data;
    }

}
